#include "dialog.h"
#include "ui_dialog.h"
#include <QQueue>
#include <QTimer>

QQueue<QString> logQue;

Dialog::Dialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Dialog)
{
    ui->setupUi(this);
    updateTimer = new QTimer(this);
    updateTimer->start(500);
    connect(updateTimer,SIGNAL(timeout()),this,SLOT(updateTimerOut()));
}

Dialog::~Dialog()
{
    delete ui;
}

void Dialog::appendLogText()
{
    ui->textEdit->clear();
    this->show();
}

void Dialog::updateTimerOut()
{
    updateTimer->start(500);
    if(logQue.isEmpty())
        return;
    QString logText = logQue.dequeue();
    ui->textEdit->append(logText);
}
